package com.zzy.j1114iocdemo;

import com.zzy.j1114iocdemo.component.UserComponent;
import com.zzy.j1114iocdemo.config.BeanConfig;
import com.zzy.j1114iocdemo.config.UserConfig;
import com.zzy.j1114iocdemo.controller.UserController;
import com.zzy.j1114iocdemo.model.UserInfo;
import com.zzy.j1114iocdemo.repo.UserRepository;
import com.zzy.j1114iocdemo.service.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

import javax.security.auth.login.Configuration;
import java.beans.Introspector;

@SpringBootApplication
public class J1114IocDemoApplication {

    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(J1114IocDemoApplication.class, args);

        UserController userController = context.getBean(UserController.class);
        userController.sayhi();
//
//        UserService userService = (UserService)context.getBean("userService");
//        userService.sayhi();
//
//        UserComponent userComponent = context.getBean("userComponent1", UserComponent.class);
//        userComponent.sayhi();

//        System.out.println(Introspector.decapitalize("UserComponent"));
//        System.out.println(Introspector.decapitalize("UserService"));
//        System.out.println(Introspector.decapitalize("USerComponent"));
        //UserRepository userRepository = (UserRepository)context.getBean("userRepository");
//        UserRepository userRepository = context.getBean("userRepository", UserRepository.class);
//        userRepository.sayhi();
//
//        UserConfig userConfig = context.getBean(UserConfig.class);
//        userConfig.sayhi();

//        UserInfo userInfo = context.getBean(UserInfo.class);
//        System.out.println(userInfo);

    }

}
